//
//  MineRequestManager.m
//  TrainTree
//
//  Created by wanghui on 2017/10/4.
//  Copyright © 2017年 YouYeShu. All rights reserved.
//

#import "MineRequestManager.h"

@implementation MineRequestManager
/**能量泉*/
+ (void)requestPowerDataResponse:(ResponseData)responseBlock
{
    RequestParam *param = [[RequestParam alloc]init];
    [param setRequestPath:TrainTreeMinePowerURL];

    [[HttpClient shareInstanceClient]GetReqeustParameter:param response:^(id JSONData, NSError *error, NSURLSessionDataTask *dataTask) {
        if (JSONData) {
            responseBlock(JSONData,error,dataTask);
        }else{
            [SVProgressHUD showErrorWithStatus:@"数据请求失败"];
        }
    }];
}
/**我的信息概述*/
+ (void)requestMineSummaryResponse:(ResponseData)responseBlock
{
    RequestParam *param = [[RequestParam alloc]init];
    [param setRequestPath:TrainTreeMineSummaryURL];
    [[HttpClient shareInstanceClient] GetReqeustParameter:param response:^(id JSONData, NSError *error, NSURLSessionDataTask *dataTask) {
        if (JSONData) {
            responseBlock(JSONData,error,dataTask);
        }else{
            [SVProgressHUD showErrorWithStatus:@"数据请求失败"];
        }
    }];
}
/**修改头像*/
+ (void)modifyMineAvatarWithAvatarUrl:(NSString *)url userId:(NSNumber *)userId Response:(ResponseData)responseBlock
{
    RequestParam *param = [[RequestParam alloc]init];
    [param setRequestPath:TrainTreeMineUpdateAvatarURL];
    [param setString:url forKey:@"avatarUrl"];
    [param setNumber:userId forKey:@"userId"];

    [[HttpClient shareInstanceClient] GetReqeustParameter:param response:^(id JSONData, NSError *error, NSURLSessionDataTask *dataTask) {
        if (JSONData) {
            responseBlock(JSONData,error,dataTask);
        }else{
            [SVProgressHUD showErrorWithStatus:@"数据请求失败"];
        }
    }];
}

/**团队管理--统计*/
+ (void)requestTeamaAalyticsResponse:(ResponseData)responseBlock
{
    RequestParam *param = [[RequestParam alloc]init];
    [param setRequestPath:TrainTreeTeamAnalyticsURL];
        [USERDEFAULT setBool:YES forKey:@"team"];
    [[HttpClient shareInstanceClient] GetReqeustParameter:param response:^(id JSONData, NSError *error, NSURLSessionDataTask *dataTask) {
        if (JSONData) {
            responseBlock(JSONData,error,dataTask);
        }else{
            [SVProgressHUD showErrorWithStatus:@"数据请求失败"];
        }
    }];
}
/**团队管理--课程管理*/
+ (void)requestTeamLessonListResponse:(ResponseData)responseBlock
{
    RequestParam *param = [[RequestParam alloc]init];
    [param setRequestPath:TrainTreeTeamLessonListURL];
    [USERDEFAULT setBool:YES forKey:@"team"];
    [[HttpClient shareInstanceClient] GetReqeustParameter:param response:^(id JSONData, NSError *error, NSURLSessionDataTask *dataTask) {
        if (JSONData) {
            responseBlock(JSONData,error,dataTask);
        }else{
            [SVProgressHUD showErrorWithStatus:@"数据请求失败"];
        }
    }];
}
/**学习记录*/
+ (void)requestStudyRecordResponse:(ResponseData)responseBlock
{
    RequestParam *param = [[RequestParam alloc]init];
    [param setRequestPath:TrainTreeMineStudyRecordURL];
    [[HttpClient shareInstanceClient]PostReqeustParameter:param response:^(id JSONData, NSError *error, NSURLSessionDataTask *dataTask) {
        if (JSONData) {
            responseBlock(JSONData,error,dataTask);
        }else{
            [SVProgressHUD showErrorWithStatus:@"数据请求失败"];
        }
    }];
}

@end
